package com.WaVel.mapper;

import com.Emplyment.vo.CompanyDataVo;
import com.Emplyment.vo.QuestionsDataVo;
import com.Emplyment.vo.UserDataVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DataMapper {

    @Select("SELECT id,title,collect_number FROM article order by collect_number DESC , createTime DESC limit 10")
    List<CompanyDataVo> getCompanyData();

    @Select("SELECT id,question,collect_num FROM question_bank order by collect_num DESC , createTime DESC limit 10")
    List<QuestionsDataVo> getQuestionData();

    @Select("SELECT DATE(create_time) AS date, COUNT(*) AS newUsers\n" +
            "FROM user\n" +
            "WHERE create_time >= DATE_SUB(NOW(), INTERVAL 30 DAY)\n" +
            "GROUP BY DATE(create_time)")
    List<UserDataVo> getUserData();
}
